<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<div class="page-header">
	<h3>错误列表</h3>
</div>
<div class="btn-toolbar" role="toolbar">
	<div class="btn-group"><button id="export">导出</button></div>
</div>
<table class="table table-striped table-hover .table-condensed">
	<thead>
		<tr>
			<th>错误类型</th>
			<th>报错信息</th>
			<th>报错时间</th>
			<th>手机型号</th>
			<th>操作系统</th>
			<th>系统版本</th>
			<th>APP版本</th>
		</tr>
	</thead>
	<tbody>
		<c:if test="${result.success eq false}">获取数据失败</c:if>
		<c:if test="${result.success eq true}">
			<c:forEach var="error" items="${result.object.list}">
				<tr>
					<td>
					<c:if test="${error.errorType eq '0'}">系统崩溃</c:if>
					<c:if test="${error.errorType eq '1'}">黑屏</c:if>
					</td>
					<td>${fn:escapeXml(fn:substring(error.stacktrace,0,20))}</td>
					<td><fmt:formatDate value="${error.errorTime}" type="both"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td>${fn:escapeXml(error.phoneModel)}</td>
					<td>${fn:escapeXml(error.osType)}</td>
					<td>${fn:escapeXml(error.osVersion)}</td>
					<td>${fn:escapeXml(error.appVersion)}</td>
				</tr>
			</c:forEach>
		</c:if>
	</tbody>
</table>
<div class="row clearfix">
	<div class="col-md-offset-4 col-md-4 column">
		<c:if test="${result.object.pageCount eq 1}">
			<font color="#337ab7">没有更多了！</font>
		</c:if>
		<ul class="pager">
			<c:if test="${result.object.pageNum > 1}">
				<li class="previous"><a href="#">&larr; 上一页</a></li>
			</c:if>
			<c:if test="${result.object.pageNum < result.object.pageCount}">
				<li class="next"><a href="#">下一页 &rarr;</a></li>
			</c:if>
		</ul>
	</div>
</div>
<script>
	$(function() {
		$(".previous").click(function() {
			$("#rightDiv").load("${basePath}/appError/list?pageNum=${result.object.pageNum-1}&productId="+$('select[id=selectProduct] :selected').attr('pid'));
		});
		$(".next").click(function() {
			$("#rightDiv").load("${basePath}/appError/list?pageNum=${result.object.pageNum+1}&productId="+$('select[id=selectProduct] :selected').attr('pid'));
		});
		$("#export").click(function() {
			window.location.href = "${basePath}/appError/export?productId="+$('select[id=selectProduct] :selected').attr('pid');
		});
		
	});
</script>